import url from "@/url.config"
import {request} from "../service"
import returnGoodsinfo from "@/views/comprehensive/stock/returnGoodsinfo";

export default ({service, request, tools}) => ({
    // 新增设备接口
    postEquipment(data) {
        return request({
            url: url.ip3 + "/equipment/save",
            method: 'post',
            data: data
        })
    },
    // 修改设备
    equipmentEdit(data) {
        return request({
            url: url.ip3 + "/equipment/edit",
            method: "put",
            data: data
        })
    },
    // 查询设备
    Poll_postselect(data) {
        return request({
            url: url.ip3 + "/equipment/findByPage",
            method: 'post',
            data: data
        })
    },
    // /api/equipment/data/latest/select
    // 历史设备查询
    Postequipmentdatalatestselect(data, page) {
        return request({

            url: url.ip3 + `/equipment/data/latest/select?size=${page.size}&current=${page.current}`,
            method: "post",
            data: data
        })
    },
    // http://10.10.10.42:8601/api/equipment/findByGeom
    // 查询设备某检测项历史数据（Echarts图）
    historyDataSelect(data) {
        return request({
            url: url.ip3 + "/equipment/data/history/data/select",
            method: "post",
            data: data
        })
    },
    // 获取历史图表数据
    postDataEquipmentStatistic(data) {
        return request({  // 没用了
            url: url.ip3 + "/equipment/data/equipmentStatistic",
            method: "post",
            data: data
        })
    },
    // /equipment/getEquipmentStatus/
    // 获取设备状态
    getEquipmentStatus(id) {
        return request({
            url: url.ip3 + `/monitor/getRealDataStatus/${id}`,
            method: "post"
        })
    },
    // 实时设备接口
    postMonitorFindRealData(data) {
        return request({
            url: url.ip3 + `/monitor/findRealData`,
            method: "post",
            data: data
        })
    },
    // 设备查询接口
    postEquipmentFindByGeom(data) {
        return request({
            url: url.ip3 + "/monitor/findMonitorByGeom",
            method: "post",
            data: data
        })
    },

    // http://47.114.117.125:8701/api/area/findAreaGeomByAreaId/区域id
    // 获取检测地区面积
    findAreaGeomByAreaId(id) {
        return request({
            url: url.ip2 + `/area/findAreaGeomByAreaId/${id}`,
            method: "get"
        })
    },

    // 获取设备数据可查看的时间实时、分钟、小时、天、。。。
    getEquipmentCnByEquipmentId(id) {
        return request({
            url: url.ip3 + `/equipment/getEquipmentCnByEquipmentId/${id}`,
            method: "get"
        })
    },


    // 获取数据检测值数据异常
    findWaringData(data) {
        return request({
            url: url.ip3 + "/equipment/data/findWaringData",
            method: "post",
            data: data
        })
    },
    // 获取视频接口
    postEquipmentFindEquipmentVideo(data) {
        return request({
            url: url.ip3 + "/equipment/findEquipmentVideo",
            method: "post",
            data: data
        })
    },
    // 新获取视频接口
    getMonitorVideoAddress(data) {
        return request({
            url: url.ip3 + "/monitor/getMonitorVideoAddress",
            method: "post",
            data: data
        })
    },
    // 获取表格接口
    getFindDataByMNGroupByDatetime(data) {
        return request({  // 没用了
            url: url.ip3 + `/equipment/data/findDataByMNGroupByDatetime/${data.current}/${data.size}`,
            method: "post",
            data: data
        })
    },
    // 数据导出
    // 10.10.10.42:8801/api/reportForm/downLoadExcel/1308387807545135105/3
    reportFormDownLoadExcel(id, type, year) {
        return request({
            url: url.ip1 + `/reportForm/downLoadExcel/${id}/${type}/${year}`,
            method: "get"
        })
    },
    // 新数据导出接口
    monitorGetMonitorHistoryDataExport(data){
        return request({
            url:url.ip3+"/monitor/getMonitorHistoryData/export",
            method:"post",
            data
        })
    },
    reportFormDownLoadExcelOne(mn,type, year) {
        return request({
            url: url.ip1 + `/reportForm/reportForm/${mn}/${type}/${year}`
        })
    },
    // 设备监测项增删改查
    // 查询设备绑定的监测项
    abnormalFindByEquipmentId(id) {
        return request({
            url: url.ip3 + `/abnormal/findByEquipmentId/${id}`,
            method: "get"
        })
    },
    // 修改设备绑定的监测项
    abnormalEdit(id, data) {
        return request({
            url: url.ip3 + `/abnormal/edit/${id}`,
            method: "put",
            data: data,
        })
    },
    // 删除设备绑定的监测项
    abnormalRemove(id, equipmentId) {
        return request({
            url: url.ip3 + `/abnormal/remove/${id}/${equipmentId}`,
            method: "delete"
        })
    },


    // /api
    // 企业接口
    // 新增企业接口
    postCompanySave(data) {
        return request({
            url: url.ip2 + "/company/save",
            method: "post",
            data: data
        })
    },
    // 修改企业接口
    putCompanyEdit(data) {
        return request({
            url: url.ip2 + "/company/edit",
            method: "put",
            data: data
        })
    },
    // 删除企业接口
    delCompanyRemove(id) {
        return request({
            url: url.ip2 + `/company/remove/${id}`,
            method: "delete"
        })
    },
    // 企业分页查询接口
    postCompanyFindByPage(data) {
        return request({
            url: url.ip2 + "/company/findByPage",
            method: "post",
            data: data
        })
    },
    // 获取公司id公司名称
    CompanyFindCompanyIdAndName() {
        return request({
            url: url.ip2 + "/company/findCompanyIdAndName",
            method: "get"
        })
    },
    // 根据用户id,查找申领的备机信息
    /**
     *
     * @param {大区id} id
     * @param {设备类型11,12,13} type
     */
    SpareFindApplyStandby(data) {
        return request({
            url: url.ip3 + `/spare/find/apply/standby`,
            method: "post",
            data: data
        })
    },
    // 部门接口
    // 部门新增
    DeptSave(data) {
        return request({
            url: url.ip2 + "/dept/save",
            method: "post",
            data: data
        })
    },
    // 修改部门
    DeptEdit(data) {
        return request({
            url: url.ip2 + "/dept/edit",
            method: "put",
            data: data
        })
    },
    // 删除部门
    DeptRemove(id) {
        return request({
            url: url.ip2 + `/dept/remove/${id}`,
            method: "delete"
        })
    },
    // 查询部门
    DeptFindByPage(data) {
        return request({
            url: url.ip2 + "/dept/findByPage",
            method: "post",
            data: data
        })
    },
    // 新设备实时数据接口
    // 获取设备状态
    monitorGetMonitorStatus(monitorType) {
        return request({
            url: url.ip3 + `/monitor/getMonitorStatus/${monitorType}`,
            method: "post"
        })
    },
    // 设备实时数据表头接口
    FindMonitorFactorsByMonitorType(monitorType) {
        return request({
            url: url.ip3 + `/monitor/findMonitorFactorsByMonitorType/${monitorType}`,
            method: "post",
        })
    },
    // 设备实时数据接口
    MonitorgetMonitorRealData(data) {
        return request({
            url: url.ip3 + "/monitor/getMonitorRealData",
            method: "post",
            data: data,
            timeout: 60000
        })
    },
    // 获取某个监测点历史数据
    MonitorgetMonitorHistoryData(data) {
        return request({
            url: url.ip3 + "/monitor/getMonitorHistoryData",
            method: "post",
            data: data
        })
    },
    // 根据排口id获取表头
    monitorFactorsFindByMonitorId(id) {
        return request({
            url: url.ip3 + `/monitorFactors/findByMonitorId/${id}`,
            method: "post"
        })
    },

    // 监测站点异常数据
    MonitorStationAbnormalData(data) {
        return request({
            url: url.ip3 + "/monitor/warning/findByPage",
            method: "post",
            data: data
        })
    },
    // 处理这条警报记录无照片接口
    handleWarningNoPic(data) {
        return request({
            url: url.ip3 + "/monitor/warning/handleWarning1",
            method: "post",
            data: data
        })
    },

    // 管控列表接口
    // 管控列表分页
    realTimeControlFind(data) {
        return request({
            url: url.ip1 + "/real/time/control/find/page",
            method: "post",
            data: data
        })
    },
    // 查找工作参数
    realTimeControlFindWorkInfo(data) {
        return request({
            url: url.ip1 + "/real/time/control/find/work/info",
            method: "post",
            data: data
        })
    },
    // 查找历史记录
    realTimeControlFindLog(data) {
        return request({
            url: url.ip1 + "/real/time/control/find/log",
            method: "post",
            data: data
        })
    },
    // 工作参数历史数据
    controlFindModifyLog(data) {
        return request({
            url: url.ip1 + "/real/time/control/find/modify/log",
            method: "post",
            data: data
        })
    },
    // 变动参数下拉框
    realTimeControlFindParameter() {
        return request({
            url: url.ip1 + "/real/time/control/find/parameter",
            method: "get"
        })
    },
    //  设备故障因子上报
    monitorErrorSave(data) {
        return request({
            url: url.ip3 + "/monitor/error/save",
            method: "post",
            data: data
        })
    }
})
